@extends('layouts.default')

@section('title')
    {{ isset($category) ? $category->name . ' -' : '话题列表'  }} @parent
@stop

@section('content')

    <div class="col-md-9 topics-index main-col">

        {{--@if (isset($category) && $category->id == config('phphub.life_category_id'))--}}
        {{--<div class="alert alert-info">--}}
        {{--『生活能为工作带来灵感，工作是为了更好的生活。』话题如旅行、移民、宠物等。发帖请遵守 <a style="text-decoration: underline;" href="https://dspstack.com/topics/3022/community-posting-and-management">社区发帖和管理规范</a>。--}}
        {{--</div>--}}
        {{--@endif--}}
        @if(isset($category))
            <div class="alert alert-info">
                {!! $category->description !!}
                @if($category->id == config('phphub.homework_help_id') && Auth::check()&&!Auth::user()->isVip())
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="{{route('vip-index')}}">
                        <button type="button" class="btn btn-danger"> 开通VIP</button>
                    </a>
                @endif
            </div>
        @endif

        @if (isset($category) && $category->id == config('phphub.qa_category_id'))
            <div class="alert alert-info">
                在 DSPSTACK，我们不提倡 <a href="{{ route('topics.show', 535) }}" style="text-decoration: underline;">新手提问</a>
                ，如果你编程遇到难题，请先 <a href="{{ route('topics.show', 3656) }}" style="text-decoration: underline;">搜索</a> 再 <a
                        href="{{ route('topics.create', ['category_id' => config('phphub.qa_category_id')]) }}"
                        class="btn btn-warning">提问</a>
            </div>
        @endif
        @if (isset($category) && $category->id == config('phphub.jobs_id'))
            @include('topics.partials.jobs_banner')
            <div class="alert alert-info">
                发布招聘帖前请必须仔细阅读 <a href="https://dspstack.com/topics/278/zhao-pin-tie-fa-bu-zhun-ze">DSPSTACK 招聘贴发布规范</a>，不按规范发帖会被管理员
                <a href="https://dspstack.com/topics/281/chen-tie-shuo-ming">永久下沉</a>。
            </div>
        @endif
        <div class="panel panel-default" style="box-shadow: 4px 4px 5px 0px rgba(50, 50, 50, 0.19);">

            <div class="panel-heading">

                <ul class="list-inline topic-filter">
                    <li class="popover-with-html" data-content="最后回复排e序">
                        <a {!! app(App\Models\Topic::class)->present()->topicFilter('default') !!}>活跃</a></li>
                    <li class="popover-with-html" data-content="只看加精的话题">
                        <a {!! app(App\Models\Topic::class)->present()->topicFilter('excellent') !!}>{{ lang('Excellent') }}</a>
                    </li>
                    <li class="popover-with-html" data-content="点赞数排序">
                        <a {!! app(App\Models\Topic::class)->present()->topicFilter('vote') !!}>{{ lang('Vote') }}</a>
                    </li>
                    <li class="popover-with-html" data-content="发布时间排序">
                        <a {!! app(App\Models\Topic::class)->present()->topicFilter('recent') !!}>{{ lang('Recent') }}</a>
                    </li>
                    <li class="popover-with-html" data-content="无人问津的话题">
                        <a {!! app(App\Models\Topic::class)->present()->topicFilter('noreply') !!}>{{ lang('Noreply') }}</a>
                    </li>
                </ul>

                <div class="clearfix"></div>
            </div>

            @if ( ! $topics->isEmpty())

                <div class="jscroll">
                    <div class="panel-body remove-padding-horizontal">
                        @include('topics.partials.topics')
                    </div>

                    <div class="panel-footer text-right remove-padding-horizontal pager-footer">
                        <!-- Pager -->
                        {!! $topics->appends(Request::except('page', '_pjax'))->render() !!}
                    </div>
                </div>

            @else
                <div class="panel-body">
                    <div class="empty-block">{{ lang('Dont have any data Yet') }}~~</div>
                </div>
            @endif

        </div>

        <!-- Nodes Listing -->
        @include('nodes.partials.list')

    </div>

    @include('layouts.partials.sidebar')

@stop
@section('scripts')
    @if (isset($category) && $category->id == config('phphub.jobs_id'))

        <script>
            $(document).ready(function () {
                $('.owl-carousel').owlCarousel({
                    margin: 12,
                    dots: false,
                    @if (isset($banners['jobs-top']) && count($banners['jobs-top']) > 3)
                    loop: true,
                    @endif
                    autoplay: true,
                    autoplayTimeout: 2500,
                    responsive: {
                        0: {
                            items: 1
                        },
                        600: {
                            items: 2
                        },
                        1000: {
                            items: 3
                        }
                    }
                });

            });

        </script>
    @endif
@stop